<template>
  <view class="container">
    <z-paging ref="paging" v-model="dataList" @query="queryList">
      <view class="" slot="top">
        <u-navbar height="50" title="我的评论" title-size="36" title-color="#333"></u-navbar>
      </view>
      <view class="comment-area">
        <view
          class="comment-box"
          @click="routeTo(item)"
          v-for="(item, index) in dataList"
          :key="index"
        >
          <view class="comment-info">
            <view class="comment-info-left">
              评分<u-rate
                class="count-r"
                disabled
                v-model="item.scores"
                active-color="#FBC258"
                inactive-color="#CCCCCC"
                gutter="10"
              ></u-rate>
              <text style="color: #999999; font-size: 22rpx">{{
                (item.scores * 0.1 * 10).toFixed(1)
              }}</text>
            </view>
            <view class="comment-info-right">
              <p style="text-align: right">2024-01-25</p>
            </view>
          </view>
          <view class="comment-content">
            <view class="">
              {{ item.content }}
            </view>
            <view class="comment-img" v-if="item.picUrls && item.picUrls.length > 0">
              <view class="image" v-for="(pic, i) in item.picUrls" :key="i">
                <u-image
                  :src="pic"
                  mode=""
                  border-radius="8"
                  width="216rpx"
                  height="145rpx"
                ></u-image>
              </view>
            </view>
          </view>

          <view class="goods-box">
            <u-icon name="/static/img/gimg.png" size="100"></u-icon>
            <view class="goods-desc u-line-1">
              {{ item.spuName }}
              <p
                ><text
                  style="margin-right: 20rpx"
                  v-for="(properties, index) in item.skuProperties"
                  :key="index"
                >
                  {{ properties.propertyName }}:{{ properties.valueName }}
                </text></p
              >
            </view>
          </view>

          <view class="" style="text-align: right">
            <view class="del-btn"> 删除评论 </view>
          </view>
        </view>
      </view>
    </z-paging>
  </view>
</template>

<script>
export default {
  data() {
    return {
      countRate: 5,
      value: 5,
      stpe: 3,
      imgStyle: {
        width: '12rem'
      },
      dataList: []
    }
  },
  onLoad() {
    // this.$nextTick(function() {
    // 	this.onOrderLoad(this.current, null, true);
    // });
    this.queryList()
  },
  methods: {
    queryList(pageNo = 1, pageSize = 10) {
      this.$u
        .get('/app-api/product/comment/my-page', {
          pageNo,
          pageSize
        })
        .then((res) => {
          this.$refs.paging.complete(res.data.list)
        })
    },
    onShare() {},
    routeTo(item) {
      uni.navigateTo({
        url: '/shops/goods-detail?goodsId=' + item.spuId
      })
    }
  }
}
</script>

<style lang="scss" scoped>
page {
  background: #eeeeef;
}

.content-tip {
  display: flex;
  height: 140rpx;
  background-color: #fff;
  margin: 20rpx 0;
  padding: 20rpx;
}

.mer-rate-left {
  flex: 3;
  text-align: center;
  view {
    font-size: 45rpx;
    font-weight: 700;
  }
  p {
    color: #666666;
  }
}

.mer-rate-right {
  flex: 7;
  margin-top: 20rpx;
  text {
    font: 35rpx;
  }
  .rate-tip {
    padding: 5rpx 10rpx;
    color: #ffac0e;
    background-color: #f5f0e6;
  }
}

.comment-img {
  margin-top: 10rpx;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .image {
    margin-top: 10rpx;
  }
}
.comment-area {
}

.comment-box {
  padding: 20rpx;
  background-color: #fff;
  margin-bottom: 10rpx;
}

.comment-top {
  overflow: auto;
}

.txt1 {
  font-size: 35rpx;
  float: left;
}

.txt2 {
  float: right;
  color: #7e7e5e;
}

.comment-info {
  overflow: auto;
  margin: 15rpx 0;
}
.comment-info-left {
  float: left;
  font-size: 30rpx;
  width: 45%;
}

.info-left-username {
  display: inline-block;
  vertical-align: top;
}

.comment-info-right {
  float: right;
}

.info-left-tx {
  width: 90rpx;
  height: 90rpx;
  border-radius: 90rpx;
}

.comment-img image {
  width: 200rpx;
  height: 200rpx;
  margin-right: 10rpx;
}

.goods-box {
  display: flex;
  align-items: center;
  padding: 15rpx 0;
  margin: 15rpx 0;
  border-top: #ededed solid 2rpx;
  border-bottom: #ededed solid 2rpx;
}
.goods-desc {
  line-height: 55rpx;
  font-size: 30rpx;
}

.goods-desc p {
  color: #999999;
  font-size: 26rpx;
}

.del-btn {
  display: inline-block;
  padding: 10rpx 20rpx;
  border: #999999 solid 2rpx;
  border-radius: 30rpx;
  color: #999999;
}
</style>
